package com.ocm.commerceinteraction.ui;

import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.ContentUris;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.easemob.chat.EMChatManager;
import com.google.gson.JsonSyntaxException;
import com.ocm.commerceinteraction.GlobalApplication;
import com.ocm.commerceinteraction.MainActivity;
import com.ocm.commerceinteraction.R;
import com.ocm.commerceinteraction.config.RequestAddr;
import com.ocm.commerceinteraction.model.BaseModel;
import com.ocm.commerceinteraction.model.FriendsList;
import com.ocm.commerceinteraction.model.GroupDetail;
import com.ocm.commerceinteraction.model.GroupDetailModel;
import com.ocm.commerceinteraction.model.UserInfo;
import com.ocm.commerceinteraction.util.MethedUtil;
import com.ocm.commerceinteraction.util.helper.DBHelper;
import com.ocm.commerceinteraction.util.helper.LogHelper;
import com.ocm.commerceinteraction.util.http.AjaxCallBack;
import com.ocm.commerceinteraction.util.http.AjaxParams;
import com.ocm.commerceinteraction.util.loading.Loading;
import com.ocm.commerceinteraction.util.view.HorizontialListView;
import com.ocm.commerceinteraction.util.view.MyAlertDialog;
import com.ocm.commerceinteraction.util.view.MyHorizontalActionImgScroll;
import com.ocm.commerceinteraction.util.view.RoundImageView;
import com.ocm.commerceinteraction.util.view.SlideSwitch;
import com.ocm.commerceinteraction.util.view.percentsupport.PercentLinearLayout;
import com.squareup.picasso.Picasso;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.FragmentArg;
import org.androidannotations.annotations.ViewById;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 */
@EFragment(R.layout.fragment_group_info)
public class GroupInfoFragment extends BaseFragment {
    private static final String TAG = "GroupInfoFragment";

    @ViewById(R.id.toptitle_title)
    TextView topTitle;

    //    @FragmentArg("group_uniq_id")
//    String group_uniq_id;
    @FragmentArg("groupDetailModel")
    GroupDetailModel groupDetailModel;

    @ViewById(R.id.riv_headImg)
    RoundImageView headImg;

    @ViewById(R.id.tv_group_name)
    TextView groupName;
    @ViewById(R.id.tv_group_id)
    TextView groupId;
    @ViewById(R.id.tv_group_annouce)
    TextView groupAnnouce;
    @ViewById(R.id.et_charRoom_number)
    TextView groupMemeberNo;

    @ViewById(R.id.ss_chatroom_switch)
    SlideSwitch chatRoomSwitch;

    @ViewById(R.id.ss_invite_member_switch)
    SlideSwitch merberSwitch;

    @ViewById(R.id.tv_creat_btn)
    TextView delete_chat_history;// 删除聊天记录

    @ViewById(R.id.tv_creat_adduser_btn)
    TextView out_chat;// 退出聊天室
    // 滑动菜单View
    MyHorizontalActionImgScroll menu;

    @ViewById(R.id.ll_img_layout)
    PercentLinearLayout ll_img_layout;
//    @ViewById(R.id.horizontialListView)
//    HorizontialListView horizontialListView;


    @Override
    @AfterViews
    void initView() {
        topTitle.setText("聊天室信息");
//        getGroupInfoHttp();
        if (groupDetailModel != null) {
            setData();
        }
    }

    @Override
    @Click({R.id.back_btn, R.id.tv_group_annouce, R.id.tv_group_name, R.id.tv_creat_btn, R.id.tv_creat_adduser_btn,
            R.id.riv_headImg, R.id.prl_all_member_layout, R.id.iv_invite_member})
    void Click(View view) {
        switch (view.getId()) {
            case R.id.back_btn:
                ChatActivity.getFragmentMangerinstance().popBackStack();
                break;
            case R.id.tv_group_name:
                showEditDiallog("修改群名称", 0);
                break;
            case R.id.tv_group_annouce:   //修改公告
                showEditDiallog("修改公告", 1);
                break;
            case R.id.tv_creat_btn:   //删除聊天记录
//                Log.e(TAG, "Click: " + groupDetailModel.getData().getHuanxing_groupid());
                if (groupDetailModel.getData() != null) {
                    clearGroupHistory(groupDetailModel.getData().getHuanxing_groupid());
                }
                break;
            case R.id.tv_creat_adduser_btn:   //退出聊天室
                if (outBtnFlag == 0) {
                    requestUrl = RequestAddr.exitGroup.replace("&group_uniq_id", groupDetailModel.getData().getGroup_uniq_id())
                            .replace("$type", "1").replace("$user_uniq_id", GlobalApplication.loginModel.getData().getUser_uniq_id());
                    GlobalApplication.xtHttp.get(requestUrl + requestParams, new AjaxCallBack<Object>() {
                        @Override
                        public void onSuccess(Object o) {
                            super.onSuccess(o);
                            baseModel = gson.fromJson(o.toString(), BaseModel.class);
                            Log.e(TAG, "onSuccess: " + "退出成功");
                            // Toast.makeText(getActivity(),"退出群成功", Toast.LENGTH_SHORT).show();
                            // Toast.makeText(getActivity(), baseModel.getMsg(), Toast.LENGTH_SHORT).show();
                        }

                        @Override
                        public void onFailure(Throwable t, int errorNo, String strMsg) {
                            super.onFailure(t, errorNo, strMsg);
                        }
                    });
                } else if (outBtnFlag == 1) {
                    requestUrl = RequestAddr.dismissGroup + "?group_uniq_id=" + groupDetailModel.getData().getGroup_uniq_id();
                    GlobalApplication.xtHttp.get(requestUrl, new AjaxCallBack<Object>() {
                        @Override
                        public void onSuccess(Object o) {
                            super.onSuccess(o);
                            baseModel = gson.fromJson(o.toString(), BaseModel.class);
                        }

                        @Override
                        public void onFailure(Throwable t, int errorNo, String strMsg) {
                            super.onFailure(t, errorNo, strMsg);
                        }
                    });
                }
                break;
            case R.id.riv_headImg:
                showPickDialog();
                break;
            case R.id.prl_all_member_layout:
                Intent intent = new Intent();
                intent.putExtra("userListEntity", (Serializable) groupDetailModel.getData().getUser_list());
                intent.setClass(getActivity(), UserListActivity_.class);
                getActivity().startActivity(intent);
                break;
            case R.id.iv_invite_member:
                Intent intent1 = new Intent();
                intent1.setClass(MainActivity.getInstance(), SelectUserActivity_.class);
                intent1.putExtra("Group_uniq_id", groupDetailModel.getData().getGroup_uniq_id());
                intent1.putExtra("flag", "invite");
                startActivity(intent1);
                break;
        }
    }


//    void getGroupInfoHttp() {
//        requestUrl = RequestAddr.getGroupInfo +
//                "?group_uniq_id=" + group_uniq_id;
//        Loading.getInstance(getActivity()).startLoading();
//        GlobalApplication.xtHttp.get(requestUrl, new AjaxCallBack<Object>() {
//
//            @Override
//            public void onSuccess(Object o) {
//                super.onSuccess(o);
//                detaData(o);
//            }
//
//            @Override
//            public void onFailure(Throwable t, int errorNo, String strMsg) {
//                super.onFailure(t, errorNo, strMsg);
//                Loading.stopLoading();
//            }
//        });
//    }

//    GroupDetailModel groupDetailModel;
//    HorListViewAdapter horListViewAdapter;

    void detaData(Object object) {
        try {
            groupDetailModel = gson.fromJson(object.toString(), GroupDetailModel.class);
        } catch (JsonSyntaxException e) {
            baseModel = gson.fromJson(object.toString(), BaseModel.class);
            Toast.makeText(GlobalApplication.getInstance(), baseModel.getMsg(), Toast.LENGTH_SHORT).show();
            return;
        }
        ChatActivity.dataChange = true;
        setData();
    }

    int outBtnFlag = 0;//0:退出群  1：解散群

    void setData() {
        //如果是群主  修改按钮为解散群
        for (int i = 0; i < groupDetailModel.getData().getUser_list().size(); i++) {
            if (groupDetailModel.getData().getUser_list().get(i).getUser_uniq_id().equals(GlobalApplication.loginModel.getData().getUser_uniq_id())) {
                if (groupDetailModel.getData().getUser_list().get(i).getLevel().equals("1")) {
                    out_chat.setText("解散该群");
                    outBtnFlag = 1;
                }
            }
        }
        if (groupDetailModel.getData().getIs_block().equals("1")) {
            merberSwitch.setState(true);
        } else {
            merberSwitch.setState(false);
        }
//        merberSwitch.setEnabled(false);// 设置全体禁言不可用  管理员才能用
//        merberSwitch.setState(false);
//        chatRoomSwitch.setEnabled(false);
//        chatRoomSwitch.setState(false);
        Picasso.with(getActivity()).load(RequestAddr.baseUrl + groupDetailModel.getData().getIcon()).into(headImg);
        groupName.setText(groupDetailModel.getData().getGroupname());
        groupId.setText(groupDetailModel.getData().getGroup_uniq_id());
        groupAnnouce.setText(groupDetailModel.getData().getNotice());
        List<GroupDetailModel.DataEntity.UserListEntity> list = groupDetailModel.getData().getUser_list();
        for (GroupDetailModel.DataEntity.UserListEntity o : list) {
                /*判断此人是否在群中*/
            if (o.getUser_uniq_id().equals(GlobalApplication.loginModel.getData().getUser_uniq_id())) {
                if (o.getLevel().equals("4")) {//群主能禁言
                    merberSwitch.setEnabled(true);
                    if (o.getIs_black().equals("1")) {
                        merberSwitch.setState(true);
                    }
                    if (o.getIs_accept_msg().equals("1")) {
                        chatRoomSwitch.setState(true);
                    }
                }
            }
        }
        groupMemeberNo.setText(groupDetailModel.getData().getUser_list().size() + "人");

//        if (ll_img_layout != null && ll_img_layout.getChildCount() > 0)
//            ll_img_layout.removeAllViews();
//        List<String> imagelist = new ArrayList<>();
        List<String> idlist = new ArrayList<>();
        FriendsList friendsList = new FriendsList();
        List<UserInfo> userInfoList = new ArrayList<>();
        for (int i = 0; i < groupDetailModel.getData().getUser_list().size(); i++) {
//            imagelist.add(RequestAddr.baseUrl + groupDetailModel.getData().getUser_list().get(i).getIcon());
//            idlist.add(groupDetailModel.getData().getUser_list().get(i).getUser_uniq_id());
            UserInfo userInfo = new UserInfo();
            userInfo.setNick(groupDetailModel.getData().getUser_list().get(i).getNick());
            userInfo.setUser_uniq_id(groupDetailModel.getData().getUser_list().get(i).getUser_uniq_id());
            userInfo.setIcon(RequestAddr.baseUrl + groupDetailModel.getData().getUser_list().get(i).getIcon());
            userInfoList.add(userInfo);
        }
        friendsList.setData(userInfoList);
        boolean flag = DBHelper.addFriendList(friendsList);
        LogHelper.i("addFriendList:" + flag);

        if (groupDetailModel.getData().getUser_list() != null) {
            menu = new MyHorizontalActionImgScroll(getActivity(), groupDetailModel.getData().getUser_list(), groupDetailModel.getData().getGroup_uniq_id(), 10,
                    2);
            ll_img_layout.addView(menu);
        }
//        horListViewAdapter = new HorListViewAdapter(getActivity(), groupDetailModel.getData().getUser_list());
//        horizontialListView.setAdapter(horListViewAdapter);

        merberSwitch.setSlideListener(new SlideSwitch.SlideListener() {
            @Override
            public void open(int viewId) {
//                LogHelper.i("open isSwitchLoad:"+isSwitchLoad);
//                if (isSwitchLoad) {
                    isBlock = "1";
                    changAnnouceHttp(3, isBlock);
//                } else {
//                    isSwitchLoad = true;
//                }
            }

            @Override
            public void close(int viewId) {
                LogHelper.i("close isSwitchLoad:"+isSwitchLoad);
//                if (isSwitchLoad) {
                    isBlock = "2";
                    changAnnouceHttp(3, isBlock);
//                } else {
//                    isSwitchLoad = true;
//                }
            }
        });

        Loading.stopLoading();
    }

    MyAlertDialog ad;

    void showEditDiallog(String title, final int flag) {
        ad = new MyAlertDialog(getActivity());
        ad.setTitle(title);
        ad.setMessage("");
        ad.setNegativeButton("   确定    ", new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ad.dismiss();
                changAnnouceHttp(flag, ad.getMessage());
            }
        });

        ad.setPositiveButton("", new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ad.dismiss();
            }
        });
    }

    /**
     * @param flag        提交类型  0://修改群名称 1://修改群公告edit_notice 2://修改是否接受并提示群消息 3://全体禁言
     * @param changeValue
     */
    void changAnnouceHttp(int flag, String changeValue) {
        requestParams = "";
        requestUrl = RequestAddr.editGroupInfo + "?group_uniq_id=" + groupDetailModel.getData().getGroup_uniq_id()
                + "&user_uniq_id=" + GlobalApplication.loginModel.getData().getUser_uniq_id();
        switch (flag) {
            case 0://修改群名称
                requestParams = "&param_name=edit_groupname&param_value=" + changeValue;
                groupName.setText(changeValue);
                break;
            case 1://修改群公告edit_notice
                requestParams = "&param_name=edit_notice&param_value=" + changeValue;
                groupAnnouce.setText(changeValue);
                break;
            case 2://修改是否接受并提示群消息
                requestParams = "&param_name=edit_acceptmsg+&param_value=" + changeValue;
                break;
            case 3://全体禁言
                requestParams = "&param_name=edit_isblock&param_value=" + changeValue;
                break;
            case 4://修改群头像
                requestParams = "&param_name=edit_icon&param_value=" + changeValue;
                break;
        }

        GlobalApplication.xtHttp.get(requestUrl + requestParams, new AjaxCallBack<Object>() {
            @Override
            public void onSuccess(Object o) {
                super.onSuccess(o);
//                detaChangeData(o);
                detaData(o);
            }

            @Override
            public void onFailure(Throwable t, int errorNo, String strMsg) {
                super.onFailure(t, errorNo, strMsg);
            }
        });
    }

    void detaChangeData(Object object) {

    }

    /**
     * 清空群聊天记录
     */
    private void clearGroupHistory(String huanxing_uuid) {
        EMChatManager.getInstance().clearConversation(huanxing_uuid);
//        Toast.makeText(getActivity(), "成功", Toast.LENGTH_SHORT).show();
        MethedUtil.showToast(getActivity(), "成功");
    }


    /**
     * 选择提示对话框
     */
    private void showPickDialog() {
        new AlertDialog.Builder(getActivity())
                .setTitle("设置头像...")
                .setNegativeButton("相册", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        Intent intent = new Intent(Intent.ACTION_PICK, null);

                        intent.setDataAndType(
                                MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                                "image/*");
                        startActivityForResult(intent, 1);
                    }
                })
                .setPositiveButton("拍照", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        dialog.dismiss();
                        /**
                         * 下面这句还是老样子，调用快速拍照功能，至于为什么叫快速拍照，大家可以参考如下官方
                         * 文档，you_sdk_path/docs/guide/topics/media/camera.html
                         * 我刚看的时候因为太长就认真看，其实是错的，这个里面有用的太多了，所以大家不要认为
                         * 官方文档太长了就不看了，其实是错的，这个地方小马也错了，必须改正
                         */
                        Intent intent = new Intent(
                                MediaStore.ACTION_IMAGE_CAPTURE);
                        // 下面这句指定调用相机拍照后的照片存储的路径
                        intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri
                                .fromFile(new File(Environment
                                        .getExternalStorageDirectory()
                                        + "/Youin/upload",
                                        "headImg.jpg")));
                        startActivityForResult(intent, 2);
                    }
                }).show();

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {
            // 如果是直接从相册获取
            case 1:
                if (data != null) {
                    startPhotoZoom(data.getData());
                }
                break;
            // 如果是调用相机拍照时
            case 2:
                if (data != null) {
                    File temp = new File(Environment.getExternalStorageDirectory()
                            + "/Youin/upload/headImg.jpg");
                    startPhotoZoom(Uri.fromFile(temp));
                }
                break;
            // 取得裁剪后的图片
            case 3:
                /**
                 * 非空判断大家一定要验证，如果不验证的话，
                 * 在剪裁之后如果发现不满意，要重新裁剪，丢弃
                 * 当前功能时，会报NullException，小马只
                 * 在这个地方加下，大家可以根据不同情况在合适的
                 * 地方做判断处理类似情况
                 *
                 */
                if (data != null) {
                    setPicToView(data);
                }
                break;
            default:
                break;

        }
        super.onActivityResult(requestCode, resultCode, data);
    }

    /**
     * 裁剪图片方法实现
     *
     * @param uri
     */
    String imagePath = "";

    public void startPhotoZoom(Uri uri) {
        /*
         * 至于下面这个Intent的ACTION是怎么知道的，大家可以看下自己路径下的如下网页
         * yourself_sdk_path/docs/reference/android/content/Intent.html
         * 直接在里面Ctrl+F搜：CROP ，之前小马没仔细看过，其实安卓系统早已经有自带图片裁剪功能,
         * 是直接调本地库的，小马不懂C C++  这个不做详细了解去了，有轮子就用轮子，不再研究轮子是怎么
         * 制做的了...吼吼
         */
        Intent intent = new Intent("com.android.camera.action.CROP");
        imagePath = getPath(getActivity(), uri);


        intent.setDataAndType(uri, "image/*");
        //下面这个crop=true是设置在开启的Intent中设置显示的VIEW可裁剪
        intent.putExtra("crop", "true");
        // aspectX aspectY 是宽高的比例
        intent.putExtra("aspectX", 1);
        intent.putExtra("aspectY", 1);
        // outputX outputY 是裁剪图片宽高
        intent.putExtra("outputX", 150);
        intent.putExtra("outputY", 150);
        intent.putExtra("return-data", true);
        startActivityForResult(intent, 3);
    }

    private void submitPic() {
        AjaxParams params = new AjaxParams();
        if (!imagePath.equals("")) {
            requestUrl = RequestAddr.uploadImg;
            try {
                params.put("file", new File(imagePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        } else {
            return;
        }

        xtHttp.post(requestUrl, params, new AjaxCallBack() {
            @Override
            public void onStart() {
                super.onStart();
            }

            @Override
            public void onSuccess(Object o) {
                super.onSuccess(o);
                dealPicData(o);
            }

            @Override
            public void onFailure(Throwable t, int errorNo, String strMsg) {
                super.onFailure(t, errorNo, strMsg);
            }
        });
    }

    private void dealPicData(Object object) {
        try {
            baseModel = gson.fromJson(object.toString(), BaseModel.class);
        } catch (JsonSyntaxException e) {
            baseModel = gson.fromJson(object.toString(), BaseModel.class);
            return;
        }
//        Toast.makeText(getActivity(), "保存成功:"+baseModel.getData(), Toast.LENGTH_SHORT).show();
        Picasso.with(getActivity()).load(RequestAddr.baseUrl + baseModel.getData()).into(headImg);
        changAnnouceHttp(4, baseModel.getData());
    }

    /**
     * 保存裁剪之后的图片数据
     *
     * @param picdata
     */
    private void setPicToView(Intent picdata) {
        Bundle extras = picdata.getExtras();
        if (extras != null) {
            Bitmap photo = extras.getParcelable("data");
            Drawable drawable = new BitmapDrawable(photo);
            headImg.setImageDrawable(drawable);
            submitPic();
        }
    }

    @TargetApi(Build.VERSION_CODES.KITKAT)
    public static String getPath(final Context context, final Uri uri) {

        final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;

        // DocumentProvider
        if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
            // ExternalStorageProvider
            if (isExternalStorageDocument(uri)) {
                final String docId = DocumentsContract.getDocumentId(uri);
                final String[] split = docId.split(":");
                final String type = split[0];

                if ("primary".equalsIgnoreCase(type)) {
                    return Environment.getExternalStorageDirectory() + "/" + split[1];
                }

                // TODO handle non-primary volumes
            }
            // DownloadsProvider
            else if (isDownloadsDocument(uri)) {

                final String id = DocumentsContract.getDocumentId(uri);
                final Uri contentUri = ContentUris.withAppendedId(
                        Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));

                return getDataColumn(context, contentUri, null, null);
            }
            // MediaProvider
            else if (isMediaDocument(uri)) {
                final String docId = DocumentsContract.getDocumentId(uri);
                final String[] split = docId.split(":");
                final String type = split[0];

                Uri contentUri = null;
                if ("image".equals(type)) {
                    contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
                } else if ("video".equals(type)) {
                    contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
                } else if ("audio".equals(type)) {
                    contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
                }

                final String selection = "_id=?";
                final String[] selectionArgs = new String[]{
                        split[1]
                };

                return getDataColumn(context, contentUri, selection, selectionArgs);
            }
        }
        // MediaStore (and general)
        else if ("content".equalsIgnoreCase(uri.getScheme())) {
            return getDataColumn(context, uri, null, null);
        }
        // File
        else if ("file".equalsIgnoreCase(uri.getScheme())) {
            return uri.getPath();
        }

        return null;
    }

    /**
     * Get the value of the data column for this Uri. This is useful for
     * MediaStore Uris, and other file-based ContentProviders.
     *
     * @param context       The context.
     * @param uri           The Uri to query.
     * @param selection     (Optional) Filter used in the query.
     * @param selectionArgs (Optional) Selection arguments used in the query.
     * @return The value of the _data column, which is typically a file path.
     */
    public static String getDataColumn(Context context, Uri uri, String selection,
                                       String[] selectionArgs) {

        Cursor cursor = null;
        final String column = "_data";
        final String[] projection = {
                column
        };

        try {
            cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                    null);
            if (cursor != null && cursor.moveToFirst()) {
                final int column_index = cursor.getColumnIndexOrThrow(column);
                return cursor.getString(column_index);
            }
        } finally {
            if (cursor != null)
                cursor.close();
        }
        return null;
    }


    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is ExternalStorageProvider.
     */
    public static boolean isExternalStorageDocument(Uri uri) {
        return "com.android.externalstorage.documents".equals(uri.getAuthority());
    }

    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is DownloadsProvider.
     */
    public static boolean isDownloadsDocument(Uri uri) {
        return "com.android.providers.downloads.documents".equals(uri.getAuthority());
    }

    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is MediaProvider.
     */
    public static boolean isMediaDocument(Uri uri) {
        return "com.android.providers.media.documents".equals(uri.getAuthority());
    }

    @Override
    public void onResume() {
        super.onResume();
//        initView();
    }

    String isBlock = "1";//1全体禁言  2否
    boolean isSwitchLoad = false;
//    @Override
//    public void open(int viewId) {
//        LogHelper.i("open");
//        switch (viewId) {
//            case R.id.ss_invite_member_switch:
//                if (isSwitchLoad) {
//                    isSwitchLoad = false;
//                    isBlock = "1";
//                    changAnnouceHttp(3, isBlock);
//                }
//                break;
//        }
//    }
//
//    @Override
//    public void close(int viewId) {
//        LogHelper.i("close");
//        switch (viewId) {
//            case R.id.ss_invite_member_switch:
//                if (isSwitchLoad) {
//                    isSwitchLoad = false;
//                    isBlock = "2";
//                    changAnnouceHttp(3, isBlock);
//                }
//                break;
//        }
//    }
}
